<?php
namespace app\api\controller\xilumarket;


use app\common\controller\Api;
use app\common\model\xilumarket\Config AS ConfigModel;

class Config extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 所有配置
     * @throws \think\Exception
     * @throws \think\exception\DbException
     */
    public function config() {
        $name = $this->request->param('name',null);
        $config = ConfigModel::getMyConfig($name);
        $this->success('查询成功',$config);
    }

    //获取单个配置
    public function get_field(){
        $field = $this->request->param('field',null);
        $name = $this->request->param('name',null);
        $config = ConfigModel::getMyConfig($name);
        $value = isset($config[$field]) ? $config[$field] : '';
        $this->success('查询成功',[$field=>$value]);
    }

}